/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Memento2;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author lcc
 */
public class Caretaker {

    public List<Originator.Memento> list = new ArrayList<Originator.Memento>();

    public void add(Originator.Memento m) {
        list.add(m);
    }

    public Originator.Memento remove() {
        Originator.Memento ultimo = null;
        if (list.size() > 0) {
            list.remove(list.size() - 1);
            ultimo = list.get(list.size() - 1);
        }

        return ultimo;
    }
}
